
(function(){
    $(".back").click(function(){
        $("body,html").animate({scrollTop:0},500)
    })
    
    $.ajax({
        type: "GET",
        url: "http://chst.vip:1234/api/getinlanddiscount",
        data: {}
    }).then(res=>{
        let arr=res.result;
        let html="";
        arr.forEach(function(item){
            html+=`
                <li>
                ${item.productImg}
                <p>${item.productName}</p>
                <p>${item.productPrice}</p>
                <p>${item.productFrom} | ${item.productTime}</p>
                </li>
            `
            
        })
        $(".box").html(html)
        $(".box").children("li").click(function(){
            x=$(this).index();
            window.location.href="http://127.0.0.1:5500/%E9%A1%B9%E7%9B%AE/pages/domesticDetail.html?productid="+x
        })
    })
})()
    

